
/**
 * This is a generated class and is not intended for modification.  
 */
package valueObjects
{
import com.adobe.fiber.styles.IStyle;
import com.adobe.fiber.styles.Style;
import com.adobe.fiber.styles.StyleValidator;
import com.adobe.fiber.valueobjects.AbstractEntityMetadata;
import com.adobe.fiber.valueobjects.AvailablePropertyIterator;
import com.adobe.fiber.valueobjects.IPropertyIterator;
import mx.events.ValidationResultEvent;
import com.adobe.fiber.core.model_internal;
import com.adobe.fiber.valueobjects.IModelType;
import mx.events.PropertyChangeEvent;

use namespace model_internal;

[ExcludeClass]
internal class _UsuarioEntityMetadata extends com.adobe.fiber.valueobjects.AbstractEntityMetadata
{
    private static var emptyArray:Array = new Array();

    model_internal static var allProperties:Array = new Array("id", "rut", "nombre", "apaterno", "amaterno", "rol", "habilitado", "alias", "contrasena");
    model_internal static var allAssociationProperties:Array = new Array();
    model_internal static var allRequiredProperties:Array = new Array("id", "rut", "nombre", "apaterno", "amaterno", "rol", "habilitado", "alias", "contrasena");
    model_internal static var allAlwaysAvailableProperties:Array = new Array("id", "rut", "nombre", "apaterno", "amaterno", "rol", "habilitado", "alias", "contrasena");
    model_internal static var guardedProperties:Array = new Array();
    model_internal static var dataProperties:Array = new Array("id", "rut", "nombre", "apaterno", "amaterno", "rol", "habilitado", "alias", "contrasena");
    model_internal static var sourceProperties:Array = emptyArray
    model_internal static var nonDerivedProperties:Array = new Array("id", "rut", "nombre", "apaterno", "amaterno", "rol", "habilitado", "alias", "contrasena");
    model_internal static var derivedProperties:Array = new Array();
    model_internal static var collectionProperties:Array = new Array();
    model_internal static var collectionBaseMap:Object;
    model_internal static var entityName:String = "Usuario";
    model_internal static var dependentsOnMap:Object;
    model_internal static var dependedOnServices:Array = new Array();
    model_internal static var propertyTypeMap:Object;

    
    model_internal var _rutIsValid:Boolean;
    model_internal var _rutValidator:com.adobe.fiber.styles.StyleValidator;
    model_internal var _rutIsValidCacheInitialized:Boolean = false;
    model_internal var _rutValidationFailureMessages:Array;
    
    model_internal var _nombreIsValid:Boolean;
    model_internal var _nombreValidator:com.adobe.fiber.styles.StyleValidator;
    model_internal var _nombreIsValidCacheInitialized:Boolean = false;
    model_internal var _nombreValidationFailureMessages:Array;
    
    model_internal var _apaternoIsValid:Boolean;
    model_internal var _apaternoValidator:com.adobe.fiber.styles.StyleValidator;
    model_internal var _apaternoIsValidCacheInitialized:Boolean = false;
    model_internal var _apaternoValidationFailureMessages:Array;
    
    model_internal var _amaternoIsValid:Boolean;
    model_internal var _amaternoValidator:com.adobe.fiber.styles.StyleValidator;
    model_internal var _amaternoIsValidCacheInitialized:Boolean = false;
    model_internal var _amaternoValidationFailureMessages:Array;
    
    model_internal var _rolIsValid:Boolean;
    model_internal var _rolValidator:com.adobe.fiber.styles.StyleValidator;
    model_internal var _rolIsValidCacheInitialized:Boolean = false;
    model_internal var _rolValidationFailureMessages:Array;
    
    model_internal var _aliasIsValid:Boolean;
    model_internal var _aliasValidator:com.adobe.fiber.styles.StyleValidator;
    model_internal var _aliasIsValidCacheInitialized:Boolean = false;
    model_internal var _aliasValidationFailureMessages:Array;
    
    model_internal var _contrasenaIsValid:Boolean;
    model_internal var _contrasenaValidator:com.adobe.fiber.styles.StyleValidator;
    model_internal var _contrasenaIsValidCacheInitialized:Boolean = false;
    model_internal var _contrasenaValidationFailureMessages:Array;

    model_internal var _instance:_Super_Usuario;
    model_internal static var _nullStyle:com.adobe.fiber.styles.Style = new com.adobe.fiber.styles.Style();

    public function _UsuarioEntityMetadata(value : _Super_Usuario)
    {
        // initialize property maps
        if (model_internal::dependentsOnMap == null)
        {
            // dependents map
            model_internal::dependentsOnMap = new Object();
            model_internal::dependentsOnMap["id"] = new Array();
            model_internal::dependentsOnMap["rut"] = new Array();
            model_internal::dependentsOnMap["nombre"] = new Array();
            model_internal::dependentsOnMap["apaterno"] = new Array();
            model_internal::dependentsOnMap["amaterno"] = new Array();
            model_internal::dependentsOnMap["rol"] = new Array();
            model_internal::dependentsOnMap["habilitado"] = new Array();
            model_internal::dependentsOnMap["alias"] = new Array();
            model_internal::dependentsOnMap["contrasena"] = new Array();

            // collection base map
            model_internal::collectionBaseMap = new Object();
        }

        // Property type Map
        model_internal::propertyTypeMap = new Object();
        model_internal::propertyTypeMap["id"] = "int";
        model_internal::propertyTypeMap["rut"] = "String";
        model_internal::propertyTypeMap["nombre"] = "String";
        model_internal::propertyTypeMap["apaterno"] = "String";
        model_internal::propertyTypeMap["amaterno"] = "String";
        model_internal::propertyTypeMap["rol"] = "String";
        model_internal::propertyTypeMap["habilitado"] = "Boolean";
        model_internal::propertyTypeMap["alias"] = "String";
        model_internal::propertyTypeMap["contrasena"] = "String";

        model_internal::_instance = value;
        model_internal::_rutValidator = new StyleValidator(model_internal::_instance.model_internal::_doValidationForRut);
        model_internal::_rutValidator.required = true;
        model_internal::_rutValidator.requiredFieldError = "rut is required";
        //model_internal::_rutValidator.source = model_internal::_instance;
        //model_internal::_rutValidator.property = "rut";
        model_internal::_nombreValidator = new StyleValidator(model_internal::_instance.model_internal::_doValidationForNombre);
        model_internal::_nombreValidator.required = true;
        model_internal::_nombreValidator.requiredFieldError = "nombre is required";
        //model_internal::_nombreValidator.source = model_internal::_instance;
        //model_internal::_nombreValidator.property = "nombre";
        model_internal::_apaternoValidator = new StyleValidator(model_internal::_instance.model_internal::_doValidationForApaterno);
        model_internal::_apaternoValidator.required = true;
        model_internal::_apaternoValidator.requiredFieldError = "apaterno is required";
        //model_internal::_apaternoValidator.source = model_internal::_instance;
        //model_internal::_apaternoValidator.property = "apaterno";
        model_internal::_amaternoValidator = new StyleValidator(model_internal::_instance.model_internal::_doValidationForAmaterno);
        model_internal::_amaternoValidator.required = true;
        model_internal::_amaternoValidator.requiredFieldError = "amaterno is required";
        //model_internal::_amaternoValidator.source = model_internal::_instance;
        //model_internal::_amaternoValidator.property = "amaterno";
        model_internal::_rolValidator = new StyleValidator(model_internal::_instance.model_internal::_doValidationForRol);
        model_internal::_rolValidator.required = true;
        model_internal::_rolValidator.requiredFieldError = "rol is required";
        //model_internal::_rolValidator.source = model_internal::_instance;
        //model_internal::_rolValidator.property = "rol";
        model_internal::_aliasValidator = new StyleValidator(model_internal::_instance.model_internal::_doValidationForAlias);
        model_internal::_aliasValidator.required = true;
        model_internal::_aliasValidator.requiredFieldError = "alias is required";
        //model_internal::_aliasValidator.source = model_internal::_instance;
        //model_internal::_aliasValidator.property = "alias";
        model_internal::_contrasenaValidator = new StyleValidator(model_internal::_instance.model_internal::_doValidationForContrasena);
        model_internal::_contrasenaValidator.required = true;
        model_internal::_contrasenaValidator.requiredFieldError = "contrasena is required";
        //model_internal::_contrasenaValidator.source = model_internal::_instance;
        //model_internal::_contrasenaValidator.property = "contrasena";
    }

    override public function getEntityName():String
    {
        return model_internal::entityName;
    }

    override public function getProperties():Array
    {
        return model_internal::allProperties;
    }

    override public function getAssociationProperties():Array
    {
        return model_internal::allAssociationProperties;
    }

    override public function getRequiredProperties():Array
    {
         return model_internal::allRequiredProperties;   
    }

    override public function getDataProperties():Array
    {
        return model_internal::dataProperties;
    }

    public function getSourceProperties():Array
    {
        return model_internal::sourceProperties;
    }

    public function getNonDerivedProperties():Array
    {
        return model_internal::nonDerivedProperties;
    }

    override public function getGuardedProperties():Array
    {
        return model_internal::guardedProperties;
    }

    override public function getUnguardedProperties():Array
    {
        return model_internal::allAlwaysAvailableProperties;
    }

    override public function getDependants(propertyName:String):Array
    {
       if (model_internal::nonDerivedProperties.indexOf(propertyName) == -1)
            throw new Error(propertyName + " is not a data property of entity Usuario");
            
       return model_internal::dependentsOnMap[propertyName] as Array;  
    }

    override public function getDependedOnServices():Array
    {
        return model_internal::dependedOnServices;
    }

    override public function getCollectionProperties():Array
    {
        return model_internal::collectionProperties;
    }

    override public function getCollectionBase(propertyName:String):String
    {
        if (model_internal::collectionProperties.indexOf(propertyName) == -1)
            throw new Error(propertyName + " is not a collection property of entity Usuario");

        return model_internal::collectionBaseMap[propertyName];
    }
    
    override public function getPropertyType(propertyName:String):String
    {
        if (model_internal::allProperties.indexOf(propertyName) == -1)
            throw new Error(propertyName + " is not a property of Usuario");

        return model_internal::propertyTypeMap[propertyName];
    }

    override public function getAvailableProperties():com.adobe.fiber.valueobjects.IPropertyIterator
    {
        return new com.adobe.fiber.valueobjects.AvailablePropertyIterator(this);
    }

    override public function getValue(propertyName:String):*
    {
        if (model_internal::allProperties.indexOf(propertyName) == -1)
        {
            throw new Error(propertyName + " does not exist for entity Usuario");
        }

        return model_internal::_instance[propertyName];
    }

    override public function setValue(propertyName:String, value:*):void
    {
        if (model_internal::nonDerivedProperties.indexOf(propertyName) == -1)
        {
            throw new Error(propertyName + " is not a modifiable property of entity Usuario");
        }

        model_internal::_instance[propertyName] = value;
    }

    override public function getMappedByProperty(associationProperty:String):String
    {
        switch(associationProperty)
        {
            default:
            {
                return null;
            }
        }
    }

    override public function getPropertyLength(propertyName:String):int
    {
        switch(propertyName)
        {
            default:
            {
                return 0;
            }
        }
    }

    override public function isAvailable(propertyName:String):Boolean
    {
        if (model_internal::allProperties.indexOf(propertyName) == -1)
        {
            throw new Error(propertyName + " does not exist for entity Usuario");
        }

        if (model_internal::allAlwaysAvailableProperties.indexOf(propertyName) != -1)
        {
            return true;
        }

        switch(propertyName)
        {
            default:
            {
                return true;
            }
        }
    }

    override public function getIdentityMap():Object
    {
        var returnMap:Object = new Object();

        return returnMap;
    }

    [Bindable(event="propertyChange")]
    override public function get invalidConstraints():Array
    {
        if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
        {
            return model_internal::_instance.model_internal::_invalidConstraints;
        }
        else
        {
            // recalculate isValid
            model_internal::_instance.model_internal::_isValid = model_internal::_instance.model_internal::calculateIsValid();
            return model_internal::_instance.model_internal::_invalidConstraints;        
        }
    }

    [Bindable(event="propertyChange")]
    override public function get validationFailureMessages():Array
    {
        if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
        {
            return model_internal::_instance.model_internal::_validationFailureMessages;
        }
        else
        {
            // recalculate isValid
            model_internal::_instance.model_internal::_isValid = model_internal::_instance.model_internal::calculateIsValid();
            return model_internal::_instance.model_internal::_validationFailureMessages;
        }
    }

    override public function getDependantInvalidConstraints(propertyName:String):Array
    {
        var dependants:Array = getDependants(propertyName);
        if (dependants.length == 0)
        {
            return emptyArray;
        }

        var currentlyInvalid:Array = invalidConstraints;
        if (currentlyInvalid.length == 0)
        {
            return emptyArray;
        }

        var filterFunc:Function = function(element:*, index:int, arr:Array):Boolean
        {
            return dependants.indexOf(element) > -1;
        }

        return currentlyInvalid.filter(filterFunc);
    }

    /**
     * isValid
     */
    [Bindable(event="propertyChange")] 
    public function get isValid() : Boolean
    {
        if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
        {
            return model_internal::_instance.model_internal::_isValid;
        }
        else
        {
            // recalculate isValid
            model_internal::_instance.model_internal::_isValid = model_internal::_instance.model_internal::calculateIsValid();
            return model_internal::_instance.model_internal::_isValid;
        }
    }

    [Bindable(event="propertyChange")]
    public function get isIdAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isRutAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isNombreAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isApaternoAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isAmaternoAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isRolAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isHabilitadoAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isAliasAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isContrasenaAvailable():Boolean
    {
        return true;
    }


    /**
     * derived property recalculation
     */
    public function invalidateDependentOnRut():void
    {
        if (model_internal::_rutIsValidCacheInitialized )
        {
            model_internal::_instance.model_internal::_doValidationCacheOfRut = null;
            model_internal::calculateRutIsValid();
        }
    }
    public function invalidateDependentOnNombre():void
    {
        if (model_internal::_nombreIsValidCacheInitialized )
        {
            model_internal::_instance.model_internal::_doValidationCacheOfNombre = null;
            model_internal::calculateNombreIsValid();
        }
    }
    public function invalidateDependentOnApaterno():void
    {
        if (model_internal::_apaternoIsValidCacheInitialized )
        {
            model_internal::_instance.model_internal::_doValidationCacheOfApaterno = null;
            model_internal::calculateApaternoIsValid();
        }
    }
    public function invalidateDependentOnAmaterno():void
    {
        if (model_internal::_amaternoIsValidCacheInitialized )
        {
            model_internal::_instance.model_internal::_doValidationCacheOfAmaterno = null;
            model_internal::calculateAmaternoIsValid();
        }
    }
    public function invalidateDependentOnRol():void
    {
        if (model_internal::_rolIsValidCacheInitialized )
        {
            model_internal::_instance.model_internal::_doValidationCacheOfRol = null;
            model_internal::calculateRolIsValid();
        }
    }
    public function invalidateDependentOnAlias():void
    {
        if (model_internal::_aliasIsValidCacheInitialized )
        {
            model_internal::_instance.model_internal::_doValidationCacheOfAlias = null;
            model_internal::calculateAliasIsValid();
        }
    }
    public function invalidateDependentOnContrasena():void
    {
        if (model_internal::_contrasenaIsValidCacheInitialized )
        {
            model_internal::_instance.model_internal::_doValidationCacheOfContrasena = null;
            model_internal::calculateContrasenaIsValid();
        }
    }

    model_internal function fireChangeEvent(propertyName:String, oldValue:Object, newValue:Object):void
    {
        this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, propertyName, oldValue, newValue));
    }

    [Bindable(event="propertyChange")]   
    public function get idStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    [Bindable(event="propertyChange")]   
    public function get rutStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    public function get rutValidator() : StyleValidator
    {
        return model_internal::_rutValidator;
    }

    model_internal function set _rutIsValid_der(value:Boolean):void 
    {
        var oldValue:Boolean = model_internal::_rutIsValid;         
        if (oldValue !== value)
        {
            model_internal::_rutIsValid = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "rutIsValid", oldValue, value));
        }                             
    }

    [Bindable(event="propertyChange")]
    public function get rutIsValid():Boolean
    {
        if (!model_internal::_rutIsValidCacheInitialized)
        {
            model_internal::calculateRutIsValid();
        }

        return model_internal::_rutIsValid;
    }

    model_internal function calculateRutIsValid():void
    {
        var valRes:ValidationResultEvent = model_internal::_rutValidator.validate(model_internal::_instance.rut)
        model_internal::_rutIsValid_der = (valRes.results == null);
        model_internal::_rutIsValidCacheInitialized = true;
        if (valRes.results == null)
             model_internal::rutValidationFailureMessages_der = emptyArray;
        else
        {
            var _valFailures:Array = new Array();
            for (var a:int = 0 ; a<valRes.results.length ; a++)
            {
                _valFailures.push(valRes.results[a].errorMessage);
            }
            model_internal::rutValidationFailureMessages_der = _valFailures;
        }
    }

    [Bindable(event="propertyChange")]
    public function get rutValidationFailureMessages():Array
    {
        if (model_internal::_rutValidationFailureMessages == null)
            model_internal::calculateRutIsValid();

        return _rutValidationFailureMessages;
    }

    model_internal function set rutValidationFailureMessages_der(value:Array) : void
    {
        var oldValue:Array = model_internal::_rutValidationFailureMessages;

        var needUpdate : Boolean = false;
        if (oldValue == null)
            needUpdate = true;
    
        // avoid firing the event when old and new value are different empty arrays
        if (!needUpdate && (oldValue !== value && (oldValue.length > 0 || value.length > 0)))
        {
            if (oldValue.length == value.length)
            {
                for (var a:int=0; a < oldValue.length; a++)
                {
                    if (oldValue[a] !== value[a])
                    {
                        needUpdate = true;
                        break;
                    }
                }
            }
            else
            {
                needUpdate = true;
            }
        }

        if (needUpdate)
        {
            model_internal::_rutValidationFailureMessages = value;   
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "rutValidationFailureMessages", oldValue, value));
            // Only execute calculateIsValid if it has been called before, to update the validationFailureMessages for
            // the entire entity.
            if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
            {
                model_internal::_instance.model_internal::isValid_der = model_internal::_instance.model_internal::calculateIsValid();
            }
        }
    }

    [Bindable(event="propertyChange")]   
    public function get nombreStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    public function get nombreValidator() : StyleValidator
    {
        return model_internal::_nombreValidator;
    }

    model_internal function set _nombreIsValid_der(value:Boolean):void 
    {
        var oldValue:Boolean = model_internal::_nombreIsValid;         
        if (oldValue !== value)
        {
            model_internal::_nombreIsValid = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "nombreIsValid", oldValue, value));
        }                             
    }

    [Bindable(event="propertyChange")]
    public function get nombreIsValid():Boolean
    {
        if (!model_internal::_nombreIsValidCacheInitialized)
        {
            model_internal::calculateNombreIsValid();
        }

        return model_internal::_nombreIsValid;
    }

    model_internal function calculateNombreIsValid():void
    {
        var valRes:ValidationResultEvent = model_internal::_nombreValidator.validate(model_internal::_instance.nombre)
        model_internal::_nombreIsValid_der = (valRes.results == null);
        model_internal::_nombreIsValidCacheInitialized = true;
        if (valRes.results == null)
             model_internal::nombreValidationFailureMessages_der = emptyArray;
        else
        {
            var _valFailures:Array = new Array();
            for (var a:int = 0 ; a<valRes.results.length ; a++)
            {
                _valFailures.push(valRes.results[a].errorMessage);
            }
            model_internal::nombreValidationFailureMessages_der = _valFailures;
        }
    }

    [Bindable(event="propertyChange")]
    public function get nombreValidationFailureMessages():Array
    {
        if (model_internal::_nombreValidationFailureMessages == null)
            model_internal::calculateNombreIsValid();

        return _nombreValidationFailureMessages;
    }

    model_internal function set nombreValidationFailureMessages_der(value:Array) : void
    {
        var oldValue:Array = model_internal::_nombreValidationFailureMessages;

        var needUpdate : Boolean = false;
        if (oldValue == null)
            needUpdate = true;
    
        // avoid firing the event when old and new value are different empty arrays
        if (!needUpdate && (oldValue !== value && (oldValue.length > 0 || value.length > 0)))
        {
            if (oldValue.length == value.length)
            {
                for (var a:int=0; a < oldValue.length; a++)
                {
                    if (oldValue[a] !== value[a])
                    {
                        needUpdate = true;
                        break;
                    }
                }
            }
            else
            {
                needUpdate = true;
            }
        }

        if (needUpdate)
        {
            model_internal::_nombreValidationFailureMessages = value;   
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "nombreValidationFailureMessages", oldValue, value));
            // Only execute calculateIsValid if it has been called before, to update the validationFailureMessages for
            // the entire entity.
            if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
            {
                model_internal::_instance.model_internal::isValid_der = model_internal::_instance.model_internal::calculateIsValid();
            }
        }
    }

    [Bindable(event="propertyChange")]   
    public function get apaternoStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    public function get apaternoValidator() : StyleValidator
    {
        return model_internal::_apaternoValidator;
    }

    model_internal function set _apaternoIsValid_der(value:Boolean):void 
    {
        var oldValue:Boolean = model_internal::_apaternoIsValid;         
        if (oldValue !== value)
        {
            model_internal::_apaternoIsValid = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "apaternoIsValid", oldValue, value));
        }                             
    }

    [Bindable(event="propertyChange")]
    public function get apaternoIsValid():Boolean
    {
        if (!model_internal::_apaternoIsValidCacheInitialized)
        {
            model_internal::calculateApaternoIsValid();
        }

        return model_internal::_apaternoIsValid;
    }

    model_internal function calculateApaternoIsValid():void
    {
        var valRes:ValidationResultEvent = model_internal::_apaternoValidator.validate(model_internal::_instance.apaterno)
        model_internal::_apaternoIsValid_der = (valRes.results == null);
        model_internal::_apaternoIsValidCacheInitialized = true;
        if (valRes.results == null)
             model_internal::apaternoValidationFailureMessages_der = emptyArray;
        else
        {
            var _valFailures:Array = new Array();
            for (var a:int = 0 ; a<valRes.results.length ; a++)
            {
                _valFailures.push(valRes.results[a].errorMessage);
            }
            model_internal::apaternoValidationFailureMessages_der = _valFailures;
        }
    }

    [Bindable(event="propertyChange")]
    public function get apaternoValidationFailureMessages():Array
    {
        if (model_internal::_apaternoValidationFailureMessages == null)
            model_internal::calculateApaternoIsValid();

        return _apaternoValidationFailureMessages;
    }

    model_internal function set apaternoValidationFailureMessages_der(value:Array) : void
    {
        var oldValue:Array = model_internal::_apaternoValidationFailureMessages;

        var needUpdate : Boolean = false;
        if (oldValue == null)
            needUpdate = true;
    
        // avoid firing the event when old and new value are different empty arrays
        if (!needUpdate && (oldValue !== value && (oldValue.length > 0 || value.length > 0)))
        {
            if (oldValue.length == value.length)
            {
                for (var a:int=0; a < oldValue.length; a++)
                {
                    if (oldValue[a] !== value[a])
                    {
                        needUpdate = true;
                        break;
                    }
                }
            }
            else
            {
                needUpdate = true;
            }
        }

        if (needUpdate)
        {
            model_internal::_apaternoValidationFailureMessages = value;   
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "apaternoValidationFailureMessages", oldValue, value));
            // Only execute calculateIsValid if it has been called before, to update the validationFailureMessages for
            // the entire entity.
            if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
            {
                model_internal::_instance.model_internal::isValid_der = model_internal::_instance.model_internal::calculateIsValid();
            }
        }
    }

    [Bindable(event="propertyChange")]   
    public function get amaternoStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    public function get amaternoValidator() : StyleValidator
    {
        return model_internal::_amaternoValidator;
    }

    model_internal function set _amaternoIsValid_der(value:Boolean):void 
    {
        var oldValue:Boolean = model_internal::_amaternoIsValid;         
        if (oldValue !== value)
        {
            model_internal::_amaternoIsValid = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "amaternoIsValid", oldValue, value));
        }                             
    }

    [Bindable(event="propertyChange")]
    public function get amaternoIsValid():Boolean
    {
        if (!model_internal::_amaternoIsValidCacheInitialized)
        {
            model_internal::calculateAmaternoIsValid();
        }

        return model_internal::_amaternoIsValid;
    }

    model_internal function calculateAmaternoIsValid():void
    {
        var valRes:ValidationResultEvent = model_internal::_amaternoValidator.validate(model_internal::_instance.amaterno)
        model_internal::_amaternoIsValid_der = (valRes.results == null);
        model_internal::_amaternoIsValidCacheInitialized = true;
        if (valRes.results == null)
             model_internal::amaternoValidationFailureMessages_der = emptyArray;
        else
        {
            var _valFailures:Array = new Array();
            for (var a:int = 0 ; a<valRes.results.length ; a++)
            {
                _valFailures.push(valRes.results[a].errorMessage);
            }
            model_internal::amaternoValidationFailureMessages_der = _valFailures;
        }
    }

    [Bindable(event="propertyChange")]
    public function get amaternoValidationFailureMessages():Array
    {
        if (model_internal::_amaternoValidationFailureMessages == null)
            model_internal::calculateAmaternoIsValid();

        return _amaternoValidationFailureMessages;
    }

    model_internal function set amaternoValidationFailureMessages_der(value:Array) : void
    {
        var oldValue:Array = model_internal::_amaternoValidationFailureMessages;

        var needUpdate : Boolean = false;
        if (oldValue == null)
            needUpdate = true;
    
        // avoid firing the event when old and new value are different empty arrays
        if (!needUpdate && (oldValue !== value && (oldValue.length > 0 || value.length > 0)))
        {
            if (oldValue.length == value.length)
            {
                for (var a:int=0; a < oldValue.length; a++)
                {
                    if (oldValue[a] !== value[a])
                    {
                        needUpdate = true;
                        break;
                    }
                }
            }
            else
            {
                needUpdate = true;
            }
        }

        if (needUpdate)
        {
            model_internal::_amaternoValidationFailureMessages = value;   
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "amaternoValidationFailureMessages", oldValue, value));
            // Only execute calculateIsValid if it has been called before, to update the validationFailureMessages for
            // the entire entity.
            if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
            {
                model_internal::_instance.model_internal::isValid_der = model_internal::_instance.model_internal::calculateIsValid();
            }
        }
    }

    [Bindable(event="propertyChange")]   
    public function get rolStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    public function get rolValidator() : StyleValidator
    {
        return model_internal::_rolValidator;
    }

    model_internal function set _rolIsValid_der(value:Boolean):void 
    {
        var oldValue:Boolean = model_internal::_rolIsValid;         
        if (oldValue !== value)
        {
            model_internal::_rolIsValid = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "rolIsValid", oldValue, value));
        }                             
    }

    [Bindable(event="propertyChange")]
    public function get rolIsValid():Boolean
    {
        if (!model_internal::_rolIsValidCacheInitialized)
        {
            model_internal::calculateRolIsValid();
        }

        return model_internal::_rolIsValid;
    }

    model_internal function calculateRolIsValid():void
    {
        var valRes:ValidationResultEvent = model_internal::_rolValidator.validate(model_internal::_instance.rol)
        model_internal::_rolIsValid_der = (valRes.results == null);
        model_internal::_rolIsValidCacheInitialized = true;
        if (valRes.results == null)
             model_internal::rolValidationFailureMessages_der = emptyArray;
        else
        {
            var _valFailures:Array = new Array();
            for (var a:int = 0 ; a<valRes.results.length ; a++)
            {
                _valFailures.push(valRes.results[a].errorMessage);
            }
            model_internal::rolValidationFailureMessages_der = _valFailures;
        }
    }

    [Bindable(event="propertyChange")]
    public function get rolValidationFailureMessages():Array
    {
        if (model_internal::_rolValidationFailureMessages == null)
            model_internal::calculateRolIsValid();

        return _rolValidationFailureMessages;
    }

    model_internal function set rolValidationFailureMessages_der(value:Array) : void
    {
        var oldValue:Array = model_internal::_rolValidationFailureMessages;

        var needUpdate : Boolean = false;
        if (oldValue == null)
            needUpdate = true;
    
        // avoid firing the event when old and new value are different empty arrays
        if (!needUpdate && (oldValue !== value && (oldValue.length > 0 || value.length > 0)))
        {
            if (oldValue.length == value.length)
            {
                for (var a:int=0; a < oldValue.length; a++)
                {
                    if (oldValue[a] !== value[a])
                    {
                        needUpdate = true;
                        break;
                    }
                }
            }
            else
            {
                needUpdate = true;
            }
        }

        if (needUpdate)
        {
            model_internal::_rolValidationFailureMessages = value;   
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "rolValidationFailureMessages", oldValue, value));
            // Only execute calculateIsValid if it has been called before, to update the validationFailureMessages for
            // the entire entity.
            if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
            {
                model_internal::_instance.model_internal::isValid_der = model_internal::_instance.model_internal::calculateIsValid();
            }
        }
    }

    [Bindable(event="propertyChange")]   
    public function get habilitadoStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    [Bindable(event="propertyChange")]   
    public function get aliasStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    public function get aliasValidator() : StyleValidator
    {
        return model_internal::_aliasValidator;
    }

    model_internal function set _aliasIsValid_der(value:Boolean):void 
    {
        var oldValue:Boolean = model_internal::_aliasIsValid;         
        if (oldValue !== value)
        {
            model_internal::_aliasIsValid = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "aliasIsValid", oldValue, value));
        }                             
    }

    [Bindable(event="propertyChange")]
    public function get aliasIsValid():Boolean
    {
        if (!model_internal::_aliasIsValidCacheInitialized)
        {
            model_internal::calculateAliasIsValid();
        }

        return model_internal::_aliasIsValid;
    }

    model_internal function calculateAliasIsValid():void
    {
        var valRes:ValidationResultEvent = model_internal::_aliasValidator.validate(model_internal::_instance.alias)
        model_internal::_aliasIsValid_der = (valRes.results == null);
        model_internal::_aliasIsValidCacheInitialized = true;
        if (valRes.results == null)
             model_internal::aliasValidationFailureMessages_der = emptyArray;
        else
        {
            var _valFailures:Array = new Array();
            for (var a:int = 0 ; a<valRes.results.length ; a++)
            {
                _valFailures.push(valRes.results[a].errorMessage);
            }
            model_internal::aliasValidationFailureMessages_der = _valFailures;
        }
    }

    [Bindable(event="propertyChange")]
    public function get aliasValidationFailureMessages():Array
    {
        if (model_internal::_aliasValidationFailureMessages == null)
            model_internal::calculateAliasIsValid();

        return _aliasValidationFailureMessages;
    }

    model_internal function set aliasValidationFailureMessages_der(value:Array) : void
    {
        var oldValue:Array = model_internal::_aliasValidationFailureMessages;

        var needUpdate : Boolean = false;
        if (oldValue == null)
            needUpdate = true;
    
        // avoid firing the event when old and new value are different empty arrays
        if (!needUpdate && (oldValue !== value && (oldValue.length > 0 || value.length > 0)))
        {
            if (oldValue.length == value.length)
            {
                for (var a:int=0; a < oldValue.length; a++)
                {
                    if (oldValue[a] !== value[a])
                    {
                        needUpdate = true;
                        break;
                    }
                }
            }
            else
            {
                needUpdate = true;
            }
        }

        if (needUpdate)
        {
            model_internal::_aliasValidationFailureMessages = value;   
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "aliasValidationFailureMessages", oldValue, value));
            // Only execute calculateIsValid if it has been called before, to update the validationFailureMessages for
            // the entire entity.
            if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
            {
                model_internal::_instance.model_internal::isValid_der = model_internal::_instance.model_internal::calculateIsValid();
            }
        }
    }

    [Bindable(event="propertyChange")]   
    public function get contrasenaStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    public function get contrasenaValidator() : StyleValidator
    {
        return model_internal::_contrasenaValidator;
    }

    model_internal function set _contrasenaIsValid_der(value:Boolean):void 
    {
        var oldValue:Boolean = model_internal::_contrasenaIsValid;         
        if (oldValue !== value)
        {
            model_internal::_contrasenaIsValid = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "contrasenaIsValid", oldValue, value));
        }                             
    }

    [Bindable(event="propertyChange")]
    public function get contrasenaIsValid():Boolean
    {
        if (!model_internal::_contrasenaIsValidCacheInitialized)
        {
            model_internal::calculateContrasenaIsValid();
        }

        return model_internal::_contrasenaIsValid;
    }

    model_internal function calculateContrasenaIsValid():void
    {
        var valRes:ValidationResultEvent = model_internal::_contrasenaValidator.validate(model_internal::_instance.contrasena)
        model_internal::_contrasenaIsValid_der = (valRes.results == null);
        model_internal::_contrasenaIsValidCacheInitialized = true;
        if (valRes.results == null)
             model_internal::contrasenaValidationFailureMessages_der = emptyArray;
        else
        {
            var _valFailures:Array = new Array();
            for (var a:int = 0 ; a<valRes.results.length ; a++)
            {
                _valFailures.push(valRes.results[a].errorMessage);
            }
            model_internal::contrasenaValidationFailureMessages_der = _valFailures;
        }
    }

    [Bindable(event="propertyChange")]
    public function get contrasenaValidationFailureMessages():Array
    {
        if (model_internal::_contrasenaValidationFailureMessages == null)
            model_internal::calculateContrasenaIsValid();

        return _contrasenaValidationFailureMessages;
    }

    model_internal function set contrasenaValidationFailureMessages_der(value:Array) : void
    {
        var oldValue:Array = model_internal::_contrasenaValidationFailureMessages;

        var needUpdate : Boolean = false;
        if (oldValue == null)
            needUpdate = true;
    
        // avoid firing the event when old and new value are different empty arrays
        if (!needUpdate && (oldValue !== value && (oldValue.length > 0 || value.length > 0)))
        {
            if (oldValue.length == value.length)
            {
                for (var a:int=0; a < oldValue.length; a++)
                {
                    if (oldValue[a] !== value[a])
                    {
                        needUpdate = true;
                        break;
                    }
                }
            }
            else
            {
                needUpdate = true;
            }
        }

        if (needUpdate)
        {
            model_internal::_contrasenaValidationFailureMessages = value;   
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "contrasenaValidationFailureMessages", oldValue, value));
            // Only execute calculateIsValid if it has been called before, to update the validationFailureMessages for
            // the entire entity.
            if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
            {
                model_internal::_instance.model_internal::isValid_der = model_internal::_instance.model_internal::calculateIsValid();
            }
        }
    }


     /**
     * 
     * @inheritDoc 
     */ 
     override public function getStyle(propertyName:String):com.adobe.fiber.styles.IStyle
     {
         switch(propertyName)
         {
            default:
            {
                return null;
            }
         }
     }
     
     /**
     * 
     * @inheritDoc 
     *  
     */  
     override public function getPropertyValidationFailureMessages(propertyName:String):Array
     {
         switch(propertyName)
         {
            case("rut"):
            {
                return rutValidationFailureMessages;
            }
            case("nombre"):
            {
                return nombreValidationFailureMessages;
            }
            case("apaterno"):
            {
                return apaternoValidationFailureMessages;
            }
            case("amaterno"):
            {
                return amaternoValidationFailureMessages;
            }
            case("rol"):
            {
                return rolValidationFailureMessages;
            }
            case("alias"):
            {
                return aliasValidationFailureMessages;
            }
            case("contrasena"):
            {
                return contrasenaValidationFailureMessages;
            }
            default:
            {
                return emptyArray;
            }
         }
     }

}

}
